{template 'common/header'}
<div class="main">
	<form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" id="form1">
		<ul class="nav nav-tabs" role="tablist">
		    <li role="presentation" class="active"><a href="#basic" role="tab" data-toggle="tab">系统设置</a></li>
		</ul>
		
		
		<div class="tab-content">
			<div role="tabpanel" class="tab-pane active panel panel-default main" id="basic">
			<div class="panel-heading">系统设置</div>
			<div class="panel-body">	
			    <div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否启用多号联营模式：</label>
					<div class="col-sm-9 col-xs-12">
						<label class="radio-inline"><input type="radio" name="system_type" value="0" {if $settings['system_type'] == 0}checked="true"{/if} /> 不启用</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="system_type" value="1" {if $settings['system_type'] == 1}checked="true"{/if} /> 启用</label>
						<span class="help-block" style="color:red;">*多号联营指可以同时建立多个相同主体的小程序、公众号（服务号）来运营，数据共享互通，前提是需要全部接入微信开放平台。</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">多号联营平台ID</label>
					<div class="col-sm-9 col-xs-12">
					  <input type="text" name="system_id" class="form-control" placeholder="" value="{if $settings['system_id']}{$settings['system_id']}{else}0{/if}" />
					  <span class="help-block" style="color:red;">*填写数字，同一个联营平台请填写相同的数字，没有则填0。</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">联营主小程序uniacid</label>
					<div class="col-sm-9 col-xs-12">
					  <input type="text" name="xcx_id" class="form-control" placeholder="" value="{if $settings['xcx_id']}{$settings['xcx_id']}{else}0{/if}" />
					  <span class="help-block" style="color:red;">*联营主小程序的uniacid。</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">起始用户编号</label>
					<div class="col-sm-9 col-xs-12">
					  <input type="text" name="uid" class="form-control" placeholder="" value="{if $settings['uid']}{$settings['uid']}{else}16800000{/if}" />
					  <span class="help-block" style="color:red;">*填写数字，第一个用户的编号会在此编号上+1，默认：16800000，最大值不要超过10位数字，如果有联营的小程序，请与小程序保持一致。</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">海报二维码类型</label>
					<div class="col-sm-9 col-xs-12">
						<label class='radio-inline'>
							<input type='radio' name='qrcode_type' value='0' {if $settings['qrcode_type']==0}checked{/if} /> 永久
						</label>
						<label class='radio-inline'>
							<input type='radio' name='qrcode_type' value='1' {if $settings['qrcode_type']==1}checked{/if} /> 临时
						</label>
						<span class="help-block" style="color:red;">*永久二维码最多10w个，临时二维码有效期最长30天</div>
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">公众号引导关注图文链接</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" id="followlink" name="followlink" class="form-control" value="{$settings['followlink']}" />
						<div class="help-block" style="color:red;">*如小程序用户未关注公众号，点击海报时则跳转到此引导关注链接。</div>
					</div>
				</div>
				<div class="form-group" style="display:none;">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否强制关注</label>
					<div class="col-sm-9 col-xs-12">
						<label class='radio-inline'>
							<input type='radio' name='isfollow' value='1' checked /> 是
						</label>
						<label class='radio-inline'>
							<input type='radio' name='isfollow' value='0' {if $settings['isfollow']==0}checked{/if} /> 否
						</label>
						<div class="help-block">是否强制关注</div>
					</div>
				</div>
				<div class="form-group" style="display:none;">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">关注方式（链接或二维码）</label>
					<div class="col-sm-9 col-xs-12">
						<label class='radio-inline'>
							<input type='radio' name='followtype' value='0' checked /> 链接
						</label>
						<label class='radio-inline'>
							<input type='radio' name='followtype' value='1' {if $settings['followtype']==1}checked{/if} /> 二维码
						</label>
					</div>
				</div>
				
			</div>
			</div>
			
		</div>
		
		<div class="form-group col-sm-12">
			<input type="submit" name="submit" value="提交" class="btn btn-primary" />
			<input type="hidden" name="token" value="{$_W['token']}" />
		</div>
	</form>
</div>
	<!-- bootstrap 引用 -->
	<script type="text/javascript">
		require(['bootstrap'], function () {

			// tab切换
			$('#myTab a').click(function (e) {
				$('#tab').val( $(this).attr('href'));
				e.preventDefault();
				$(this).tab('show');
			})

			// tip提示
			$('.btn,.tip').each(function(){
				if( $(this).closest('td').css('position')=='relative'){
					return true;
				}
				$(this).hover(function () {
					$(this).tooltip('show');
				}, function () {
					$(this).tooltip('hide');
				});
			})

			// 弹出提示
			$('.btn.tip-pop,.tip-pop').each(function(){
				if( $(this).closest('td').css('position')=='relative'){
					return true;
				}
				$(this).hover(function () {
					$(this).popover();
				}, function () {
					$(this).popover();
				});
			})

		});
		
		// 复制链接
		$('.js-clip').each(function(){
			util.clip(this, $(this).attr('data-url'));
		});
	</script>
	<script type="text/javascript">
	
		$("input:radio[name='isfollow']").click(function(){
			var isfollow = $(this).val();
			if(isfollow == 1){
				$(".follow_box").show();
			}
			if(isfollow == 0){
				$(".follow_box").hide();
			}
		});
		
		$("input:radio[name='followtype']").click(function(){
			var followtype = $(this).val();
			$("#followtype"+followtype).show().siblings().hide();
		});
		
		require(['jquery', 'util'], function($, util){
			
			$('.longurl_but').click(function(){
				var but = $(this);
				var ipt = but.prev();

				util.linkBrowser(function(href){
					var site_url = "{$_W['siteroot']}";
					if(href.substring(0, 4) == 'tel:') {
						util.message('长链接不能设置为一键拨号');
						return;
					} else if(href.indexOf("http://") == -1 && href.indexOf("https://") == -1) {
						href = href.replace('./index.php?', '/index.php?');
						href = site_url + 'app' + href;
					}
					ipt.val(href);
				});
			});
			
		});
	</script>
	
{template 'common/footer'}